<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:component xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:c="http://java.sun.com/jsp/jstl/core">



	<!-- PopUp per la ricerca dei clienti -->
	<rich:popupPanel id="popupRicercaClienti" width="500" height="500"
		domElementAttachment="parent">
		<f:facet name="header">Seleziona Cliente</f:facet>
		<f:facet name="controls">
			<h:outputLink value="#"
				style="font-size:large; color:black; textdecoration:none;"
				onclick="#{rich:component('popupRicercaClienti')}.hide();return false;">X
				</h:outputLink>
		</f:facet>

			<rich:extendedDataTable id="tabellaRicercaClienti"
				value="#{selectBean.clientiAttivi}" var="cliente"
				selection="#{selectBean.selection}"
				selectionMode="#{selectBean.selectionMode}" rows="10">
				<a4j:ajax event="selectionchange"
					listener="#{selectBean.tableListener}" />

				<rich:column width="100px">
					<f:facet name="header">Id</f:facet>
					<h:outputText value="#{cliente.idCliente}" />
				</rich:column>


				<rich:column width="350px"
					filterValue="#{genericFilterBean.denominazioneCLiente}"
					filterExpression="#{fn:containsIgnoreCase(cliente.denominazione,genericFilterBean.denominazioneCLiente)}"
					filterType="custom" style="text-align:center;">
					<f:facet name="header">
						<h:outputLabel value="Denominazione" />
						<h:inputText value="#{genericFilterBean.denominazioneCLiente}" >
							<a4j:ajax event="blur" render="tabellaRicercaClienti" />
						</h:inputText>
					</f:facet>
					<h:outputText value="#{cliente.denominazione}" />
				</rich:column>

				<f:facet name="footer">
					<rich:dataScroller />
				</f:facet>

			</rich:extendedDataTable>

			<br/>
			<br/>
			
			<a4j:commandButton value="Aggiungi Cliente"
						action="#{tab.object.setCliente(selectBean.clienteSelezionato)}"
						oncomplete="#{rich:component('popupRicercaClienti')}.hide();return false;"
						render="pannelloParteDescrittivaFattura" execute="@this"
						rendered="#{fn:containsIgnoreCase(tab.name,'Fattura')}">
					</a4j:commandButton>

			<a4j:commandButton value="Aggiungi Cliente"
						action="#{tab.object.setCliente(selectBean.clienteSelezionato)}"
						oncomplete="#{rich:component('popupRicercaClienti')}.hide();return false;"
						render="pannelloParteDescrittivaOrdine" execute="@this"
						rendered="#{fn:containsIgnoreCase(tab.name,'Ordine')}">
					</a4j:commandButton>
					
	
	</rich:popupPanel>















</ui:component>
